package com.zjhhsd.blackJack.mapper;

import com.zjhhsd.blackJack.model.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository//使得接口也能自动注入
public interface UserMapper {

    @Select("select * from user where username = #{name} and password = #{password}")
    User verify(@Param("name")String username, @Param("password")String password);

    @Select("select * from user where username = #{name}")
    User getByName(@Param("name") String username);

    @Insert("INSERT INTO user (username, password, signature, score, boss_time, boss_win, boss_loss, normal_time, normal_win, normal_loss) VALUES (#{name}, #{password}, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);")
    void insert(@Param("name")String username, @Param("password")String password);

}
